
/*
 * @Autor: Mr Lu
 * @Version: 1.0
 * @Date: 2019-12-03
 * @LastEditors: OBKoro1
 * @LastEditTime: 2019-12-03
 * @Description:  待办任务
 */
<template>
  <div id="TaskToDo" class="p-box">
    <div class="p-return">
      <mu-appbar color="primary" class="lan-header">
        <mu-button icon slot="left" v-close>
          <i class="iconfont angle-left iconangle-left"></i>
          <span class="lan-header-back">返回</span>
        </mu-button>待办任务
      </mu-appbar>
    </div>
    <div class="p-content">
      <wallModule name="任务总计(件)" :total="totalCount" :bgImage="wallBgImage" />
      <div class="number-box" v-for="(menu) in numberList" :key="menu.id">
        <div class="number-title">{{menu.moduleName}}</div>
        <div class="number-content">
          <div class="number-list">
            <div
              class="number-item"
              v-for="(mod) in menu.moduleList"
              :key="mod.id"
              :style="{backgroundImage:`url(${mod.bgImage})`}"
              @click="skipPage(mod)"
            >
              <p class="name">{{mod.name}}</p>
              <p class="total">{{mod.total}}</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import WeatherModule from "@/weather/WeatherModule";
import wallModule from "@/wall/wallModule";
export default {
  name: "TaskToDo",
  components: {
    WeatherModule,
    wallModule
  },
  data() {
    return {
      totalCount: 0,
      wallBgImage: require("#/assets/img/wall/wall.png"),
      numberList: [
        {
          id: "1",
          moduleName: "协同检查",
          moduleList: [
            {
              id: "1-1",
              name: "检查工作",
              total: 0,
              bgColor:
                "linear-gradient(164deg,rgba(0,183,231,1) 0%,rgba(0,128,203,1) 100%)",
              bgImage: require("#/assets/img/wall/wallBlue.png"),
              path: "checkList"
            },
            {
              id: "1-2",
              name: "整改工作",
              total: 0,
              bgColor:
                "linear-gradient(164deg,rgba(8,221,220,1) 0%,rgba(0,203,201,1) 100%)",
              bgImage: require("#/assets/img/wall/wallChing.png"),
              path: "rectificationWork"
            },
            {
              id: "1-3",
              name: "复查工作",
              total: 0,
              bgColor:
                "linear-gradient(164deg,rgba(0,231,166,1) 0%,rgba(0,203,109,1) 100%)",
              bgImage: require("#/assets/img/wall/wallGreen.png"),
              path: "reviewList"
            },
            {
              id: "1-4",
              name: "审批工作",
              total: 0,
              bgColor:
                "linear-gradient(161deg,rgba(195,232,218,1) 0%,rgba(129,196,184,1) 100%)",
              bgImage: require("#/assets/img/wall/wallYellowGreen.png"),
              path: "approveList"
            }
          ]
        },
        {
          id: "2",
          moduleName: "质量工匠之星",
          moduleList: [
            {
              id: "2-1",
              name: "待我审批",
              total: 0,
              bgColor:
                "linear-gradient(164deg,rgba(89,149,230,1) 0%,rgba(93,123,219,1) 100%)",
              bgImage: require("#/assets/img/wall/wallPuple.png"),
              path: "Approve",
              params:{type:'approve'}
            }
          ]
        }
      ]
    };
  },
  computed: {},
  created() {
    this.initPage();
  },
  mounted() {},
  watch: {},
  methods: {
    skipPage(item) {
      let query = item.params
      let obj = {name: item.path}
      query && (obj['query'] = {...query})
      this.$router.push(obj);
    },
    initPage() {
      this.$openLoading();
      //待办任务数量
      let params = {
        orgId: this.$A.GS("orgInfo")["orgId"],
        type: this.$A.GS("orgInfo")["type"],
        userId: this.$A.GS("userInfo")["userId"]
      };
      this.$A.Go("get", "/safety/unDoCount/statistic", params).then(
        response => {
          this.$closeLoading();
          if (response.code == 200) {
            this.totalCount = response.body.totalCount;
            this.$set(
              this.numberList[0].moduleList[0],
              "total",
              response.body.checkCount
            ); //检查数量
            this.$set(
              this.numberList[0].moduleList[1],
              "total",
              response.body.rectCount
            ); //整改数量
            this.$set(
              this.numberList[0].moduleList[2],
              "total",
              response.body.reviewCount
            ); //复查数量
            this.$set(
              this.numberList[0].moduleList[3],
              "total",
              response.body.checkApprovalCount
            ); //检查审批数量
            this.$set(
              this.numberList[1].moduleList[0],
              "total",
              response.body.starApprovalCount
            ); //工匠之星审批数量
          }
        },
        err => {
          this.$closeLoading();
          console.log(err);
        }
      );
    }
  },
  destroyed() {}
};
</script>

<style lang="scss">
#TeamWorkCheck {
}
</style>
